package com.wxcms.service.impl;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;

import com.wxcms.domain.SysUser;
import com.wxcms.service.SysUserService;

@Service
public class SysUserServiceImpl implements SysUserService {

	@Value(value="WEB-INF/sysuser.properties")
    private  Resource data;
	
	public SysUser queryUser(String username) {
		SysUser user = null;
		try {
			File file = data.getFile();
			Properties prop = new Properties();
			prop.load(new FileInputStream(file));
			String passwd = prop.getProperty(username);
			if(null != passwd){
				user = new SysUser();
				user.setUsername(username);
				user.setPasswd(passwd);
			}
		} catch (IOException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
		return user;
	}

}
